home *** CD-ROM | disk | FTP | other *** search
/ User's Choice Windows CD / User's Choice Windows CD (CMS Software)(1993).iso / utility3 / scroll.zip / SCROLL.TXT < prev   
Text File  |  1991-07-11  |  2KB  |  52 lines

  1.  
  2. Sub Form_Resize ()
  3.  
  4.   ' Repostioin scrollbars and parent picture control
  5.   VScroll1.Move ScaleWidth - VScroll1.Width, 0, VScroll1.Width, ScaleHeight - HScroll1.Height
  6.   HScroll1.Move 0, ScaleHeight - HScroll1.Height, ScaleWidth - VScroll1.Width
  7.   Picture1.Move 0, 0, VScroll1.Left, HScroll1.Top
  8.  
  9.   ' Enable or Disable VScroll1 depending on new size of Form
  10.   VScroll1.Value = 0  'Generates VScroll1_Change() event
  11.   VDiff = Picture1.ScaleHeight - Picture2.Height
  12.   VScroll1.Enabled = VDiff <= 0
  13.   If VScroll1.Enabled Then
  14.       VScroll1.Max = Abs(VDiff)
  15.       VScroll1.LargeChange = VScroll1.Max \ 10
  16.   End If
  17.   
  18.   ' Enable or Disable HScroll1 depending on new size of Form
  19.   HScroll1.Value = 0
  20.   HDiff = Picture1.ScaleWidth - Picture2.Width
  21.   HScroll1.Enabled = HDiff <= 0
  22.   If HScroll1.Enabled Then
  23.       HScroll1.Max = Abs(HDiff)
  24.       HScroll1.LargeChange = HScroll1.Max \ 10
  25.   End If
  26.  
  27. End Sub
  28.  
  29. Sub HScroll1_Change ()
  30.  
  31.   ' Picture.Left is set to the Negative of the value since
  32.   ' as you scroll the Scrollbar to the Right, the display
  33.   ' should move to the Left, showing more of the right
  34.   ' of the display, and vice-versa when scrolling to the
  35.   ' left
  36.  
  37.   Picture2.Left = -HScroll1.Value
  38.  
  39. End Sub
  40.  
  41. Sub VScroll1_Change ()
  42.   
  43.   ' Picture.Top is set to the Negative of the value since
  44.   ' as you scroll the Scrollbar down, the display
  45.   ' should move up, showing more of the the bottom
  46.   ' of the display, and vice-versa when scrolling up
  47.   
  48.   Picture2.Top = -VScroll1.Value
  49.   
  50. End Sub
  51.  
  52.